﻿using BySoft.Server.Common;
using BySoft.Server.Common.Entity;
using BySoft.Server.DataAccess;
using BySoft.Server.DataAccess.UserCode;
using OneSoft.DataAccess;
using OneSoft.EntityCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BySoft.Server.Business
{
    public partial class BsOutmatreturn
    {

        public static bool IsBillIDExists(string OutmatreturnIDValue)
        {

            return ClsComm.CheckExist("BS_Outmatreturn", "BillID", OutmatreturnIDValue, true);
           
        }
        public static bool CheckUsed(string BillIDValue)
        {
            return false;
           // return ClsComm.CheckExist("BS_Outmatreturn", "BillID", BillIDValue, true);
           
        }
        public static bool SaveOrUpdate(BsOutmatreturnEntity entity, DataTable OutmatreturnDetailDT, bool isNew)
        {
            return BsOutmatreturnDA.SaveOrUpdate(entity, OutmatreturnDetailDT, isNew);
        }

        public static bool Del(string strCode)
        {
            return BsOutmatreturnDA.Del(strCode);
        }

        public static DataTable SelectList(string strBillID,string strWorkOrderNo, string strSupplierID, string From, string End, int pageIndex, int PageSize, out int m_count)
        {
            return BsOutmatreturnDA.SelectList(strBillID,strWorkOrderNo, strSupplierID, From, End, pageIndex, PageSize, out m_count);
        }

        public static DataTable SelectOutProcessDetail(string strCurrentReturnBillID,string strBillID, string strWorkOrderNo, string strSupplierID, string strProcessID
             ,int  pageIndex, int PageSize, out int m_count)
        {
            return BsOutmatreturnDA.SelectOutProcessDetail(strCurrentReturnBillID,strBillID,strWorkOrderNo,strSupplierID, strProcessID, pageIndex, PageSize, out m_count);
        }
        // 发料数量，可用数量//bsoutorder
        //public static DataTable SelectSendCanbackNum(string strCurrentReturnBillID,string sendID, string materialID) {
        //    return BsOutmatreturnDA.SelectSendCanbackNum(strCurrentReturnBillID, sendID, materialID);
    
        //}
        public static DataTable SelectOutProcessDetail(string strCurrentReturnBillID,string strBillID)
        {
            int pageIndex = 0;
            int PageSize = 100;
            int m_count = 0;

            return BsOutmatreturnDA.SelectOutProcessDetail( strCurrentReturnBillID,strBillID, null, null, null, pageIndex, PageSize, out m_count);
        }
      
           public static DataTable SelectHeadData(string strBillID)
           {
               return BsOutmatreturnDA.SelectHeadData(strBillID);
           }
           public static DataTable SelectDetailData(string strBillID)
           {
               return BsOutmatreturnDA.SelectDetailData(strBillID);
           }


           public static DataTable CreateDT()
           {
        
            DataTable dt = new DataTable();
            dt.Columns.Add("WorkOrderNo");
            dt.Columns.Add("ScheduleID");
            dt.Columns.Add("ScheduleDetailID");
            dt.Columns.Add("PlanID");
            dt.Columns.Add("ExpectInStockDate");
            dt.Columns.Add("Remark");
            dt.Columns.Add("ProcessID");
            dt.Columns.Add("ProcessName");



            dt.Columns.Add("ScheduleNum");//0 
            dt.Columns.Add("IsNew");//是否新增
            dt.Columns.Add("IsDel");//是否删除
            return dt;
     
           }


           public static DataTable CreateDetailDT()
           {


               //   /* bsd.ScheduleDetailID , bsd.WorkOrderNo,bsd.ScheduleID,bsd.PlanID,bsd.ExpectInStockDate, bsd.Remark,
         //bsp.ProcessID,
 
         //bsm.MaterialID, bsm.TotalNum as Nums,bsm.ActulSendDate,bsm.ActulSendNum,
         //m.MaterialTypeID, m.MaterialName, m.Specifications, m.IsDirect, m.Unit,
         //mmt.MaterialTypeName
               //    * /
               DataTable dt = SelectDetailData("-1");
               return dt;

           }
    }
}
